import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { Cache } from "../../../cache/Cache";
import { SVIPInfo } from "../../../../../Message/Game/SVIPInfo";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
import { MsgManager } from "../../../manager/MsgManager";
import { Language } from "../../../../../extend/language/Language";
//class VIPInfoUpdateCommand
    
    export  class VIPInfoUpdateCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc1=Cache.instance.vip.vipInfo;
            var loc2=arg1.messageBase as SVIPInfo;
            Cache.instance.vip.vipInfo = loc2;
            NetDispatcher.dispatchCmd(ServerCommand.VIPInfoUpdateCommand, loc2);
            this.addTips(loc1, loc2);
            return;
        }

        /* internal  */addTips(arg1: SVIPInfo, arg2: SVIPInfo): void
        {
            var loc1=null;
            if (!arg1) 
            {
                return;
            }
            if (arg2.transportTimes > arg1.transportTimes) 
            {
                MsgManager.addTipText(Language.getStringByParam(41288, (arg2.transportTimes - arg1.transportTimes).toString()));
                MsgManager.showRollTipsMsg(Language.getStringByParam(41288, (arg2.transportTimes - arg1.transportTimes).toString()));
            }
            if (arg2.loopBookTimes > arg1.loopBookTimes) 
            {
                loc1 = Language.getStringByParam(41288, (arg2.loopBookTimes - arg1.loopBookTimes).toString());
                MsgManager.addTipText(loc1);
                MsgManager.showRollTipsMsg(loc1);
            }
            return;
        }
    }
